package com.gemme.gemme.view;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.DecelerateInterpolator;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.gemme.gemme.R;

import androidx.annotation.RequiresApi;

public class XinYuanDanMutiView extends RelativeLayout {
    private Context context;
    @RequiresApi(api = Build.VERSION_CODES.M)
    public XinYuanDanMutiView(Context context) {
        this(context,null);
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    public XinYuanDanMutiView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    public XinYuanDanMutiView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }
    HorizontalScrollView scrollView;
    LinearLayout ll_content;
    @RequiresApi(api = Build.VERSION_CODES.M)
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.xinyuandan_muti_view,this);
//        DpUtil

        scrollView = findViewById(R.id.scrollView);

        ll_content = findViewById(R.id.ll_content);

        initContrl();
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    private void initContrl() {
        scrollView.setOnScrollChangeListener(new OnScrollChangeListener() {
            @Override
            public void onScrollChange(View view, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
                toListenerChildView();
            }
        });
    }

    private void toListenerChildView() {
        try {
            for (int i = 0; i < ll_content.getChildCount(); i++) {
                XinYuanDanView xydview  = (XinYuanDanView) ll_content.getChildAt(i);
                xydview.setScaleY(1.1f);
                xydview.setChange();
            }
        }catch (Exception e){

        }
    }


}
